Repository navigation
batch: reverse with the type's operations and the close cascade - #50
Merged
Merged
Conversation
- reverseOf takes the type's Operations from meta. Schema carries them now (AssetType.Operations, Schema.canOperate). A created asset whose type has no Delete (Conversation lists only Join and Leave) gets a note instead of a command the server refuses. An inverse operation the type lacks is handled the same way. (versionone/gh-v1#21) - An asset whose command the server reports as failed goes in receipt.failed and is no longer also listed in skipped as "changed since the snapshot". (versionone/gh-v1#21) - Undoing Inactivate or QuickClose now reopens what the close cascaded to. Before the send, the receipt records each closing target's open descendants, top down through Children (openDescendants). After it, the receipt records the ones now closed (cascaded), and the reverse reactivates the parent and then those, in that order. Their after-stamps are recorded too, so batch.reversible checks them for drift. If they can't be read back, the reverse notes what it did not reopen. QuickClose gets Reactivate as its inverse. (versionone/gh-v1#48) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016NSWj8mSZ8LrMj16R2cozL
Run against v1sdktesting. Inactivate and QuickClose on a Story close its open Task as well. The receipt records that Task as cascaded, and the reverse reopens the Story and then the Task. A Task that was closed before the batch stays closed. A created Conversation is left out of the reverse with a note, and undoing its Expression reports no failure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016NSWj8mSZ8LrMj16R2cozL
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the SDK side of versionone/gh-v1#21 and versionone/gh-v1#48.
Changes
Reverse uses the type's operations (gh-v1#21)
AssetType.Operations(bare names, from meta.v1'sOperationskeys) andSchema.canOperate(type, op), which returnsundefinedwhen it doesn't know.reverseOftakes an optionalReverseContext. When a created asset's type has noDelete(a Conversation lists onlyJoin/Leave), the reverse adds a note instead of a command the server would refuse. An inverse operation the type lacks gets the same treatment. Without schema info the behaviour is unchanged.receipt.failed: touched assets whose command the server reports as failed. They are no longer also listed inskippedas "changed since the snapshot".Cascade-aware undo of a close (gh-v1#48)
Inactivate/QuickClosealso close the asset's open descendants, butReactivatereopens only the asset it names.receipt.openDescendantsrecords each closing target's open descendants, top down throughChildren.receipt.cascadedrecords the descendants that are now closed. The reverse reactivates the parent first, then those descendants. Their after-stamps are recorded, sobatch.reversiblechecks them for drift.QuickClosenow hasReactivateas its inverse.Testing
npm run verifypasses: typecheck, build, 131 unit tests, 4 of them new.test/integration/batch.test.ts, run against v1sdktesting:InactivateandQuickCloseon a Story close its open Task.Not included
gh-v1#49 (use Moment instead of ChangeDate for the staleness check) conflicts with
guard.tsandtest/integration/guard.test.ts. Those show that a filter on an earlier Moment selects the asset as it was then, so it can't detect a stale write. It needs its repro before any change.Generated by Claude Code